import org.slf4j.LoggerFactory

def logger = LoggerFactory.getLogger('LiteFlowScript')
def requestData = _meta.requestData
def rateStr = requestData.get('rate')
def rate = rateStr ? rateStr.toDouble() : null
def filteredConfigs = defaultContext.getData('filteredConfigs')
def filtered = []

filteredConfigs.each { item ->
    def configData = item.config.configData
    def minRate = configData.get('minRate')?.get(0)?.toDouble()
     def maxRate = configData.get('maxRate')?.get(0)?.toDouble()
    logger.info('当前配置,最低利率：{},最高利率：{},客户利率：{}',minRate, maxRate, rate)
    if (minRate != null && maxRate != null && rate != null && rate >= minRate && rate <= maxRate) {
        logger.info('当前配置满足条件，添加到结果中：{}', item.config.configData)
        filtered << item
    }
};  
logger.info('利率结果：{}',filtered.toString())
defaultContext.setData('filteredConfigs', filtered)
